1. Technical Field
The embodiments herein generally relate to image compression techniques, and, more particularly, to real-time image compression techniques.
2. Description of the Related Art
Image compression is the application of data compression on digital images. In effect, the objective is to reduce redundancy of the image data in order to store and/or transmit data in an efficient form. Image compression can be lossy or lossless. Generally, lossless image compression means all the data from the original file is preserved. Lossy compression, on the other hand, removes some data from the original file and saves the image with a reduced file size.
JPEG (Joint Photographic Experts Group) is a commonly used method of lossy compression for photographic images. The human eye is fairly good at seeing small differences in brightness over a relatively large area, but not so good at distinguishing the exact strength of a high frequency brightness variation. This fact allows one to get away with a greatly reduced amount of information in the high frequency components.
This is performed by simply dividing each component in the frequency domain by a constant for that component, and then rounding to the nearest integer. This is the main lossy operation in the whole process. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality.
FIG. 1 illustrates a standard known JPEG compression technique. Each image data is divided into 8×8 blocks of pixels and each color component is processed independently. Thus, a pixel is of a single value even in a color image. A discrete cosine transform (DCT) is applied to each 8×8 block. The DCT 102 converts the spatial image representation into a frequency map. In the quantization operation 104, an appropriate amount of information is discarded, and the compressor divides each output value of the DCT 102 by a “quantization coefficient” and rounds the result to an integer. The larger the quantization coefficient, the more data is lost because the actual DCT value is less and less accurate. A zig-zag scan operation 106 converts 8×8 blocks into a 64-point vector. The entropy encoding operation 108 performs an entropy encoding on the quantized coefficient to obtain further compression.
However, the JPEG compression output size is variable according to the image content; i.e., the images with less details results in less output size and images with more details result in more size. To overcome this, image size is controlled by adjusting the values of quantization matrix elements. JPEG allows one matrix to be used and the quantization matrix values are adjusted to control the output size by using a scaling factor.
However, in order to adjust the matrix coefficients for a certain image, prior knowledge of the image content is needed to be able to choose the suitable scaling factor that would control the output size so as not to exceed a certain buffer size (a target buffer size). An early knowledge of the image content is not available in real-time compression as for example in real-time video compression the scene could suddenly change.